package com.xxdemo.site;

import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.time.LocalDateTime;

public class WebServerDetailDto implements Serializable {
    //
    private Long id;

    // 例如 "media"
    // 要求: 只能写主机名, 禁止附带完整域名
    private String hostname;

    // 例如 "http://media.example.com"
    // 要求: 允许带http以及冒号斜杠开头, http://或rtsp://
    private String publicUri;

    // 备注服务器的类型, 例如OSS对象存储
    private String serviceType;

    // 简介
    private String briefDescription;

    // 站点上线日期
    private LocalDateTime onlineSince;

    // 一般备注信息
    private String notice;

    // 默认值null空指针(或字符串"false"), 否则设置任意非零值表示此条记录已过期作废
    private String deprecated;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getHostname() {
        return hostname;
    }

    public void setHostname(String hostname) {
        this.hostname = hostname;
    }

    public String getPublicUri() {
        return publicUri;
    }

    public void setPublicUri(String publicUri) {
        this.publicUri = publicUri;
    }

    public String getServiceType() {
        return serviceType;
    }

    public void setServiceType(String serviceType) {
        this.serviceType = serviceType;
    }

    public String getBriefDescription() {
        return briefDescription;
    }

    public void setBriefDescription(String briefDescription) {
        this.briefDescription = briefDescription;
    }

    public LocalDateTime getOnlineSince() {
        return onlineSince;
    }

    public void setOnlineSince(LocalDateTime onlineSince) {
        this.onlineSince = onlineSince;
    }

    public String getNotice() {
        return notice;
    }

    public void setNotice(String notice) {
        this.notice = notice;
    }

    public String getDeprecated() {
        int diff = StringUtils.compareIgnoreCase(deprecated, "true");
        if (0 == diff) {
            return "true";
        }
        return "false";
    }

    public void setDeprecated(String deprecated) {
        // 允许存入null值
        this.deprecated = deprecated;
    }
}
